package com.free;

import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import java.util.TimeZone;

/**
 * @author: lichuanming
 * @date: 2023/12/04
 */
@SpringBootApplication
public class Application implements CommandLineRunner {

    @Resource
    private CanalClient canalClient;

    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }

    @PostConstruct
    void init() {
        TimeZone.setDefault(TimeZone.getTimeZone("GMT+8"));
    }

    @Override
    public void run(String... args) throws Exception {
        // 项目启动,执行canal客户端监听
        canalClient.run();
    }
}
